﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="OtherControl.ascx.cs" Inherits="UCWebpart.Admin.OtherControl" %>

  <style>
        table
        {
            border: 1px solid #B1CDE3;
            padding:0;
            margin:0 auto;
            border-collapse: collapse;
            ruby-align:left;
            text-align:left;
        }
        td
        {
            border: 1px solid #B1CDE3;
            background: #fff;
            font-size:12px;
            color: #4f6b72;
            text-align: left;
        }
  </style>

<table style="float:left" ><tr>
   
    <td >
     <div style="overflow-y:scroll;height:250px;width:250px; text-align: left;">
        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" CellPadding="4" ForeColor="#333333" GridLines="None">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:TemplateField ShowHeader="False">
            <EditItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="更新"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="编辑"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="id" HeaderText="编号" InsertVisible="False" ReadOnly="True" SortExpression="id" Visible="False" />
        <asp:BoundField DataField="Type" HeaderText="场地类型" SortExpression="Type" />
        <asp:CheckBoxField DataField="available" HeaderText="可用" SortExpression="available" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView></div></td>
    <td><div style="overflow-y:scroll;height:250px;width:250px; text-align: left;">
        <asp:GridView ID="GridView2" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="id" DataSourceID="SqlDataSource2" ForeColor="#333333" GridLines="None">
    <AlternatingRowStyle BackColor="White" />
    <Columns>
        <asp:TemplateField ShowHeader="False">
            <EditItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update" Text="更新"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel" Text="取消"></asp:LinkButton>
            </EditItemTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit" Text="编辑"></asp:LinkButton>
                &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Delete" Text="删除"></asp:LinkButton>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:BoundField DataField="id" HeaderText="编号" InsertVisible="False" ReadOnly="True" SortExpression="id" Visible="False" />
        <asp:BoundField DataField="addressName" HeaderText="地址" SortExpression="addressName" />
        <asp:CheckBoxField DataField="available" HeaderText="可用" SortExpression="available" />
    </Columns>
    <EditRowStyle BackColor="#2461BF" />
    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
    <RowStyle BackColor="#EFF3FB" />
    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
    <SortedAscendingCellStyle BackColor="#F5F7FB" />
    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
    <SortedDescendingCellStyle BackColor="#E9EBEF" />
    <SortedDescendingHeaderStyle BackColor="#4870BE" />
</asp:GridView></div></td>
</tr>
    <tr>
        <td>
            <div runat="server" id ="type"> 
            <p>
                <asp:TextBox ID="TextBox1" runat="server" Width="130px"></asp:TextBox>
                <asp:Button ID="Button1" runat="server" Height="21px" OnClick="Button1_Click" Text="添加" />
            </p>
            </div>
        </td>
        <td>
            <div runat="server" id="add">
            <p>
            <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
            <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="添加" />
            </p>
            </div>
        </td>
    </tr>
</table>


<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:meetingroomManagementConnectionString %>" 
    DeleteCommand="UPDATE [MTR_bas_Type] SET [available] = 'false' WHERE [id] = @id" InsertCommand="INSERT INTO [MTR_bas_Type] ([Type], [available]) VALUES (@Type, @available)" 
    SelectCommand="SELECT id, Type, available FROM MTR_bas_Type WHERE (available = 'true')" 
    UpdateCommand="UPDATE [MTR_bas_Type] SET [Type] = @Type, [available] = @available WHERE [id] = @id">
    <DeleteParameters>
        <asp:Parameter Name="id" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="Type" Type="String" />
        <asp:Parameter Name="available" Type="Boolean" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="Type" Type="String" />
        <asp:Parameter Name="available" Type="Boolean" />
        <asp:Parameter Name="id" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:meetingroomManagementConnectionString %>"
     DeleteCommand="DELETE FROM [MTR_bas_AddressName] WHERE [id] = @id" 
    InsertCommand="INSERT INTO [MTR_bas_AddressName] ([addressName], [available]) VALUES (@addressName, @available)" 
    SelectCommand="SELECT * FROM [MTR_bas_AddressName]" 
    UpdateCommand="UPDATE [MTR_bas_AddressName] SET [addressName] = @addressName, [available] = @available WHERE [id] = @id">
    <DeleteParameters>
        <asp:Parameter Name="id" Type="Int32" />
    </DeleteParameters>
    <InsertParameters>
        <asp:Parameter Name="addressName" Type="String" />
        <asp:Parameter Name="available" Type="Boolean" />
    </InsertParameters>
    <UpdateParameters>
        <asp:Parameter Name="addressName" Type="String" />
        <asp:Parameter Name="available" Type="Boolean" />
        <asp:Parameter Name="id" Type="Int32" />
    </UpdateParameters>
</asp:SqlDataSource>



